import { App } from './app';
import Util from './util';
import { Page } from './page';


App.registerCrud({
	route: 'goodcategory',//路由名称
	url: $.config('apiUrl') + 'good-category',
	title: '商品分类',//分页标题
	capable: {
		create: true
	},
	columns: [{
		dataField: 'code',
		caption: '商品编码'
	}, {
		dataField: 'name',
		caption: '商品分类名称'//名称
	}, {
		minWidth: 120,
		caption: '操作',
		buttons: [{
			title: '编辑',
			url: '#/goodcategory/edit/{{id}}'//#/路由名称/edit/{{id}}
		}]
	}],
	form: {
		readOnly: false,
		showColonAfterLabel: true,
		showValidationSummary: false,
		colCount: 1,
		beforeSubmit: function (form, id) {
			form.option('formData', Object.assign({ type: 'admin' }, form.option('formData')));

			return true;
		},
		items: [{
			dataField: 'name',
			label: { text: '商品分类名称' },
			validationRules: [{ type: "required" }],
		},{
			dataField: 'code',
			label: { text: '商品编码' },
			validationRules: [{ type: "required" }],
		}]
	}
});

App.registerCrud({
	route: 'projecttype',//路由名称
	url: $.config('apiUrl') + 'project-type',
	title: '项目类型',//分页标题
	capable: {
		create: true
	},
	columns: [{
		dataField: 'code',
		caption: '项目类型编号'
	}, {
		dataField: 'name',
		caption: '项目类型名称'//名称
	}, {
		minWidth: 120,
		caption: '操作',
		buttons: [{
			title: '编辑',
			url: '#/projecttype/edit/{{id}}'//#/路由名称/edit/{{id}}
		}]
	}],
	form: {
		readOnly: false,
		showColonAfterLabel: true,
		showValidationSummary: false,
		colCount: 1,
		beforeSubmit: function (form, id) {
			form.option('formData', Object.assign({ type: 'admin' }, form.option('formData')));

			return true;
		},
		items: [{
			dataField: "code",
			validationRules: [{ type: "required" }],
			label: { text: '项目类型编号' }//名称
		}, {
			dataField: 'name',
			label: { text: '项目类型名称' },
			validationRules: [{ type: "required" }],
		}]
	}
});

App.registerCrud({
	route: 'site',//路由名称
	url: $.config('apiUrl') + 'site',
	title: '场地类型',//分页标题
	capable: {
		create: true
	},
	columns: [{
		dataField: 'code',
		caption: '场地类型编号'
	}, {
		dataField: 'name',
		caption: '场地类型名称'//名称
	}, {
		minWidth: 120,
		caption: '操作',
		buttons: [{
			title: '编辑',
			url: '#/site/edit/{{id}}'//#/路由名称/edit/{{id}}
		}]
	}],
	form: {
		readOnly: false,
		showColonAfterLabel: true,
		showValidationSummary: false,
		colCount: 1,
		beforeSubmit: function (form, id) {
			form.option('formData', Object.assign({ type: 'admin' }, form.option('formData')));

			return true;
		},
		items: [{
			dataField: "code",
			validationRules: [{ type: "required" }],
			label: { text: '场地类型编号' }//名称
		}, {
			dataField: 'name',
			label: { text: '场地类型名称' },
			validationRules: [{ type: "required" }],
		}]
	}
});

App.registerCrud({
	route: 'laborrelation',//路由名称
	url: $.config('apiUrl') + 'labor-relation',
	title: '劳务关系',//分页标题
	capable: {
		create: true
	},
	columns: [{
		dataField: 'code',
		caption: '编号'
	}, {
		dataField: 'name',
		caption: '名称'//名称
	}, {
		minWidth: 120,
		caption: '操作',
		buttons: [{
			title: '编辑',
			url: '#/laborrelation/edit/{{id}}'//#/路由名称/edit/{{id}}
		}]
	}],
	form: {
		readOnly: false,
		showColonAfterLabel: true,
		showValidationSummary: false,
		colCount: 1,
		beforeSubmit: function (form, id) {
			form.option('formData', Object.assign({ type: 'admin' }, form.option('formData')));

			return true;
		},
		items: [{
			dataField: "code",
			validationRules: [{ type: "required" }],
			label: { text: '编号' }//名称
		}, {
			dataField: 'name',
			label: { text: '名称' },
			validationRules: [{ type: "required" }],
		}]
	}
});



App.registerCrud({
	route: 'module',//路由名称
	url: $.config('apiUrl') + 'module',
	title: '功能模块',//分页标题
	capable: {
		create: true
	},
	columns: [{
		dataField: 'code',
		caption: '程序识别编码'
	}, {
		dataField: 'name',
		caption: '名称'//名称
	}, {
		minWidth: 120,
		caption: '操作',
		buttons: [{
			title: '编辑',
			url: '#/module/edit/{{id}}'//#/路由名称/edit/{{id}}
		}]
	}],
	form: {
		readOnly: false,
		showColonAfterLabel: true,
		showValidationSummary: false,
		colCount: 1,
		beforeSubmit: function (form, id) {
			form.option('formData', Object.assign({ type: 'admin' }, form.option('formData')));

			return true;
		},
		items: [{
			dataField: "code",
			validationRules: [{ type: "required" }],
			label: { text: '程序识别编码' }//名称
		}, {
			dataField: 'name',
			label: { text: '名称' },
			validationRules: [{ type: "required" }],
		}]
	}
});


App.registerCrud({
	route: 'roomtype',//路由名称
	url: $.config('apiUrl') + 'room-type',
	title: '房间模块',//分页标题
	capable: {
		create: true
	},
	columns: [{
		dataField: 'code',
		caption: '编号'
	}, {
		dataField: 'name',
		caption: '名称'//名称
	}, {
		minWidth: 120,
		caption: '操作',
		buttons: [{
			title: '编辑',
			url: '#/roomtype/edit/{{id}}'//#/路由名称/edit/{{id}}
		}]
	}],
	form: {
		readOnly: false,
		showColonAfterLabel: true,
		showValidationSummary: false,
		colCount: 1,
		beforeSubmit: function (form, id) {
			form.option('formData', Object.assign({ type: 'admin' }, form.option('formData')));

			return true;
		},
		items: [{
			dataField: "code",
			validationRules: [{ type: "required" }],
			label: { text: '编号' }//名称
		}, {
			dataField: 'name',
			label: { text: '名称' },
			validationRules: [{ type: "required" }],
		}]
	}
});


App.registerCrud({
	route: 'status',//路由名称
	url: $.config('apiUrl') + 'status',
	title: '状态模块',//分页标题
	capable: {
		create: true
	},
	columns: [{
		dataField: 'code',
		caption: '程序识别编码'
	}, {
		dataField: 'name',
		caption: '名称'//名称
	}, {
		minWidth: 120,
		caption: '操作',
		buttons: [{
			title: '编辑',
			url: '#/status/edit/{{id}}'//#/路由名称/edit/{{id}}
		}]
	}],
	form: {
		readOnly: false,
		showColonAfterLabel: true,
		showValidationSummary: false,
		colCount: 1,
		beforeSubmit: function (form, id) {
			form.option('formData', Object.assign({ type: 'admin' }, form.option('formData')));

			return true;
		},
		items: [{
			dataField: "code",
			label: { text: '程序识别编码' }//名称
		}, {
			dataField: 'name',
			label: { text: '名称' },
			validationRules: [{ type: "required" }],
		}]
	}
});